/**   
* @Title: promoteInfoWebViewAct.java 
* @Package com.esun.rabbit2.viewer.mainact.lotteryhallact 
* @Description: (推广信息web view) 
* @author: City Jiangsy@500wan.com   
* @date: 2011-7-27 下午05:18:45  
* Copyright: (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
*/
package com.esun.rabbit2.viewer.mainact.lotteryhallact;

import com.esun.config.Config;
import com.esun.ui.R;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

/** 
 * @ClassName: promoteInfoWebViewAct 
 * @Description:(推广信息web view) 
 * @author: City Jiangsy@500wan.com
 * @date: 2011-7-27 下午05:18:45 
 *  
 */
public class PromoteInfoWebViewAct extends Activity implements OnClickListener {

	private ImageButton btnCancel;
	private WebView wvContent;
	private TextView tvTitle;
	private RelativeLayout relativeProgress;
	private FrameLayout frameTitle;
	private Bundle bundleHelpAct;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		overridePendingTransition(R.anim.zoom_in,R.anim.zoom_out);
		setContentView(R.layout.hlpe_act);
		initUI();
	}

	private void initUI() {
		// TODO Auto-generated method stub
		btnCancel = (ImageButton) findViewById(R.id.helpact_btn_back);
		btnCancel.setOnClickListener(this);
		bundleHelpAct = this.getIntent().getExtras();

		relativeProgress = (RelativeLayout) findViewById(R.id.helpact_relative_progress);
		tvTitle = (TextView) findViewById(R.id.helpact_tv_title);
		tvTitle.setText(bundleHelpAct.getString("title"));

		frameTitle = (FrameLayout) findViewById(R.id.helpact_frame_title);
		if (bundleHelpAct.getString("havetitle").equals(Config.NUM0)) {
			frameTitle.setVisibility(View.GONE);
		} else {
			frameTitle.setVisibility(View.VISIBLE);
		}

		wvContent = (WebView) findViewById(R.id.helpact_webbiew);
		wvContent.setWebViewClient(new WebViewClient() {

			@Override
			public void onPageFinished(WebView view, String url) {
				// TODO Auto-generated method stub
				super.onPageFinished(view, url);
				relativeProgress.setVisibility(View.GONE);
				wvContent.setVisibility(View.VISIBLE);
			}

			@Override
			public void onPageStarted(WebView view, String url, Bitmap favicon) {
				// TODO Auto-generated method stub
				super.onPageStarted(view, url, favicon);
				relativeProgress.setVisibility(View.VISIBLE);
			}

		});
		wvContent.loadUrl(bundleHelpAct.getString("url"));

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.helpact_btn_back:
			PromoteInfoWebViewAct.this.finish();
			break;

		default:
			break;
		}

	}

}
